package com.ruoyi.project.emr.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.emr.domain.EmrDiagnosis;
import com.ruoyi.project.emr.service.IEmrDiagnosisService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 确诊信息Controller
 *
 * @author gzu
 * @date 2023-07-22
 */
@RestController
@RequestMapping("/emr/diagnosis")
public class EmrDiagnosisController extends BaseController
{
    @Autowired
    private IEmrDiagnosisService emrDiagnosisService;

    /**
     * 查询确诊信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(EmrDiagnosis emrDiagnosis)
    {
        startPage();
        List<EmrDiagnosis> list = emrDiagnosisService.selectEmrDiagnosisList(emrDiagnosis);
        return getDataTable(list);
    }

    /**
     * 获取确诊信息详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(emrDiagnosisService.selectEmrDiagnosisById(id));
    }

    /**
     * 新增确诊信息
     */
    @PostMapping
    public AjaxResult add(@RequestBody EmrDiagnosis emrDiagnosis)
    {
        return toAjax(emrDiagnosisService.insertEmrDiagnosis(emrDiagnosis));
    }

    /**
     * 修改确诊信息
     */
    @PutMapping
    public AjaxResult edit(@RequestBody EmrDiagnosis emrDiagnosis)
    {
        return toAjax(emrDiagnosisService.updateEmrDiagnosis(emrDiagnosis));
    }

    /**
     * 删除确诊信息
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(emrDiagnosisService.deleteEmrDiagnosisByIds(ids));
    }
}
